﻿{smcl}
{* 21July2017}{...}
{hi:help corr2docx}
{hline}

{title:Title}

{phang}
{bf:corr2docx} {hline 2} Report Pearson&Spearman coefficient of correlation to formatted table in DOCX file.

{marker syntax}{...}
{title:Syntax}

{p 8 17 2}
{cmdab:corr2docx} {it:varlist} [{it:if}] [{it:in}] {it:using filename} {cmd:,} [{it:options}]

where varlist is a list of non-string variables,or _all.  The * and ? wildcards are allowed in varlist.


{marker description}{...}
{title:Description}

{pstd}
{cmd:corr2docx} can report coefficient of correlation which can be reported in detail model.Users can also append
the output from {cmd:corr2docx} to other docx documents, which is more likely to be generated by {cmd:putdocx}, {cmd:reg2docx}, {cmd:sum2docx}, {cmd:t2docx} and ect, either using the {it:append} option or the 
command can be as following: {p_end}

{phang}
{stata `"putdocx append d:/mytable0.docx d:/mytable1.docx d:/mytable2.docx, saving(d:/mytable.docx,replace)"'}
{p_end}



{marker options}{...}
{title:Options for corr2docx}

{phang}
{opt replace} permits to overwrite an existing file. {p_end}

{phang}
{opt append} permits to append the output to an existing file. {p_end}

{phang}
{opt fmt(string)} specify the display format of the coefficient of correlation.By defulat,it`s %04.3f. {p_end}

{phang}
{opt title(string)} specify the title of the table.By defulat,it`s "Correlation Coefficient". {p_end}

{phang}
{opt star}{opt [}{opt (symbol level [...])}{opt ]} must specify the significance level of the coefficient of correlation from higher to lower.By defulat,it`s *** p<0.01, ** p<0.05, * p<0.1 {p_end}

{phang}
{opt note(string)} specifies notes to be displayed at the bottom-left corner of the table.By defulat,it`s empty. {p_end}

{phang}
{opt addone} add number 1 to the main diagonal of correlation matrix. {p_end}



{marker example}{...}
{title:Example}

{pstd}

{phang}
{stata `"sysuse auto, clear"'}
{p_end}

{pstd}
Report Pearson&Spearman coefficient of correlation for variable mpg weight length rep78 and foreign

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace"'}
{p_end}

{phang}
{stata `"corr2docx mpg weight length rep78 foreign if foreign == 1 using d:/temp1.docx, replace note("foreign car")"'}
{p_end}

{pstd}
Add significance of the coefficient of correlation

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star"'}
{p_end}

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, append star(** 0.01 * 0.05)"'}
{p_end}

{pstd}
Note about what you want to note

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star note(Noting about what you want to)"'}
{p_end}

{pstd}
Add the table title

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star note(Noting about what you want to) title("this is the coefficient of correlation")"'}
{p_end}

{pstd}
Add number 1 to the main diagonal of correlation matrix

{phang}
{stata `"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star addone"'}
{p_end}





{title:Author}

{pstd}Chuntao LI{p_end}
{pstd}China Stata Club(爬虫俱乐部){p_end}
{pstd}Wuhan, China{p_end}
{pstd}chtl@zuel.edu.cn{p_end}

{pstd}Zhengxuan ZHAO{p_end}
{pstd}China Stata Club(爬虫俱乐部){p_end}
{pstd}Wuhan, China{p_end}
{pstd}Zhengxuan_ZHAO@foxmail.com{p_end}

{pstd}Haitao SI{p_end}
{pstd}China Stata Club(爬虫俱乐部){p_end}
{pstd}Wuhan, China{p_end}
{pstd}sht_finance@foxmail.com{p_end}

